unit OptionFormUnit;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, IniFiles, Buttons, ExtCtrls;

type
  TOptionForm = class(TForm)
    BitBtn1: TBitBtn;
    GroupBox1: TGroupBox;
    NotEmbedCheckBox: TCheckBox;
    GroupBox2: TGroupBox;
    CalcCopySheetsCheckBox: TCheckBox;
    GroupBox3: TGroupBox;
    LastCalcsEdit: TLabeledEdit;
    procedure FormCreate(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
  private
    { Private declarations }
    ini: TIniFile;
  public
    { Public declarations }
  end;

var
  OptionForm: TOptionForm;

implementation

{$R *.dfm}

procedure TOptionForm.FormCreate(Sender: TObject);
begin
    ini:=TIniFile.Create(ExtractFilePath(Application.ExeName)+'options.ini');
    NotEmbedCheckBox.Checked:=boolean(ini.ReadInteger('main','ViewEmbed',0));
    CalcCopySheetsCheckBox.Checked:=boolean(ini.ReadInteger('main','CalcCopySheets',0));
    LastCalcsEdit.Text:=ini.ReadString('main','LastCalcs','5');

end;

procedure TOptionForm.FormDestroy(Sender: TObject);
begin
    ini.WriteInteger('main','ViewEmbed',integer(NotEmbedCheckBox.Checked));
    ini.WriteInteger('main','CalcCopySheets',integer(CalcCopySheetsCheckBox.Checked));
    ini.WriteString('main','LastCalcs',LastCalcsEdit.Text);
    ini.Free;
end;

end.
